import request from '@/utils/request'

/**
 * [获取所有菜单信息]
 * @return {[type]} [description]
 */
export function getAllMenus() {
  return request({
    url: '/menu/getAllMenus',
    method: 'get'
  })
}

/**
 * [获取所有菜单信息]
 * @return {[type]} [description]
 */
export function getSubmenuAll() {
  return request({
    url: '/menu/getSubmenuAll',
    method: 'get'
  })
}

/**
 * [根绝Id删除菜单]
 * @param  {[type]} id [description]
 * @return {[type]}    [description]
 */
export function deleteMenu(id) {
  return request({
    url: '/menu/deleteMenu',
    method: 'post',
    params: { id }
  })
}
/**
 * [更新或插入菜单]
 * @param  {[type]} menu [菜单信息]
 */
export function saveOrUpdateMenu(menu) {
  return request({
    url: '/menu/saveOrUpdateMenu',
    method: 'post',
    data: menu
  })
}
/**
 * [根据id获取菜单信息]
 * @param  {[type]} id [菜单id]
 */
export function getMenuById(id) {
  return request({
    url: '/menu/getMenuById',
    method: 'get',
    params: { id }
  })
}
